{{--这里放的是分页信息模板
    这里需要2个参数：
        $datas数据，
        $prefix分页url字符串
--}}

<style>
    #topage { padding:2px 5px;width:50px;text-align:center;
        border:1px solid #e0e0e0;border-bottom:1px solid #91cc91; }
</style>
<script>
    function toPage(){
        var page = $("#topage").val();
        if (page!='') {
            window.location.href = '{{$prefix_url}}?page='+page;
        }
    }
</script>


<div class="am-cf">
    每页 {{$datas->limit}}条记录，
    共 {{$datas->lastPage()}} 页，
    <br>
    共 {{$datas->total()}} 条记录，
    当前是第 {{$datas->currentPage()}} 页
    <div class="am-fr">
        <input type="text" id="topage" placeholder="页码" value="{{isset($_GET['page'])?$_GET['page']:''}}">
        <a href="javascript:;" onclick="toPage()">跳转至该页</a>
        <ul class="am-pagination">
            @if ($datas->currentPage() > 1 && $datas->currentPage() != 1)
                <li class="am-active">
                    <a href="{{$prefix_url}}"
                       style="cursor:pointer;" title="回到首页"
                    >首页</a>
                </li>
            @elseif ($datas->currentPage() == 1 && $datas->currentPage() == 1)
                <li class="am-disabled"><a href="{{$prefix_url}}">首页</a></li>
            @endif
            @if ($datas->lastPage() > 1 && $datas->currentPage() != 1)
                <li class="am-active">
                    <a href="{{$datas->previousPageUrl()}}"
                       style="cursor:pointer;" title="跳转至上一页"
                    >«上一页</a>
                </li>
            @elseif ($datas->currentPage() == 1)
                <li class="am-disabled"><a href="{{$datas->previousPageUrl()}}">«上一页</a></li>
            @endif
            @if ($datas->lastPage() > 1 && $datas->currentPage() != $datas->lastPage())
                <li class="am-active">
                    <a href="{{$datas->nextPageUrl()}}"
                       style="cursor:pointer;" title="跳转至下一页"
                    >下一页»</a>
                </li>
                <li class="am-active">
                    <a href="{{$prefix_url.'?page='.$datas->lastPage()}}"
                       style="cursor:pointer;" title="跳转至尾页"
                    >尾页</a>
                </li>
            @elseif ($datas->currentPage() == $datas->lastPage())
                <li class="am-disabled"><a href="{{$datas->nextPageUrl()}}">下一页»</a></li>
                <li class="am-disabled"><a href="{{$prefix_url.'?page='.$datas->lastPage()}}">尾页</a></li>
            @endif
        </ul>
        <hr><br>
    </div>
</div>